package com.sc.nft.dao;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.EquitySharePanel;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.EquityProfitRule;
import com.sc.nft.mapper.EquityProfitRuleMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (sc_equity_profit_rule)数据DAO
 *
 * @author zxy
 * @since 2024-08-31 18:09:02
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class EquityProfitRuleDao extends ServiceImpl<EquityProfitRuleMapper, EquityProfitRule> {


    public EquityProfitRule findByName(String name){
        return lambdaQuery().eq(EquityProfitRule::getProfitName,name).one();
    }

    public List<EquityProfitRule> findByStatus(Boolean status){
        return lambdaQuery().eq(EquityProfitRule::getStatus,status).list();
    }

    public Page<EquityProfitRule> findPageByName(Page page, String name, Boolean status){
        return lambdaQuery().like(StrUtil.isNotBlank(name),EquityProfitRule::getProfitName,name).eq(status!=null,EquityProfitRule::getStatus,status).page(page);
    }


}